Skip to content

Conversation

@peterharperuk
Copy link
Contributor

I can run openocd without sudo on Raspberry Pi OS and Ubuntu when running on rpi, but my virtual box seems to need it. This seems to cause people to worry and raise support issues, so I suggest we add some details about the udev rule required.

@peterharperuk
Copy link
Contributor Author

@lurch


NOTE: When you use the Debug Probe to upload a binary the ELF version of the file is used, not the UF2 file that you would use when you drag-and-drop.

On linux you might be able to run `openocd` without `sudo` depending on your distribution. If it doesn't work without `sudo` you can add a udev rule, e.g. add the following to `/etc/udev/rules.d/51-usb-perms.rules` and reload your udev rules with `sudo udevadm control --reload ; sudo udevadm trigger`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linux->Linux

Comment on lines +17 to +21
On linux you might be able to run `openocd` without `sudo` depending on your distribution. If it doesn't work without `sudo` you can add a udev rule, e.g. add the following to `/etc/udev/rules.d/51-usb-perms.rules` and reload your udev rules with `sudo udevadm control --reload ; sudo udevadm trigger`

----
SUBSYSTEM=="usb", ATTR{idVendor}=="0a5c", ATTR{idProduct}=="000c", GROUP="plugdev", MODE="0660"
----
Copy link
Contributor

@nathan-contino nathan-contino Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On linux you might be able to run `openocd` without `sudo` depending on your distribution. If it doesn't work without `sudo` you can add a udev rule, e.g. add the following to `/etc/udev/rules.d/51-usb-perms.rules` and reload your udev rules with `sudo udevadm control --reload ; sudo udevadm trigger`
----
SUBSYSTEM=="usb", ATTR{idVendor}=="0a5c", ATTR{idProduct}=="000c", GROUP="plugdev", MODE="0660"
----
[TIP]
====
If this command requires `sudo`, you can remove the `sudo` requirement by adding the following udev rule to `/etc/udev/rules.d/51-usb-perms.rules`:
----
SUBSYSTEM=="usb", ATTR{idVendor}=="0a5c", ATTR{idProduct}=="000c", GROUP="plugdev", MODE="0660"
----
Reload your udev rules with `sudo udevadm control --reload ; sudo udevadm trigger`. You should now be able to run `openocd` without `sudo`.
====

Suggestion: move this to an admonition block, since it's not part of the standard instruction flow. Streamline the wording a bit. Some minor changes to follow the documentation style guide, e.g. introducing code blocks with a colon and a clear description.

NOTE: we should probably merge #3523 first because it's big, important, and this PR could introduce merge conflicts since there's lot of scattered renaming in the same file edited in this PR.

@lurch
Copy link
Contributor

lurch commented Feb 15, 2024

Like was done with raspberrypi/picotool#50 , perhaps it's better to just provide a pre-written .rules file that people can copy into /etc/udev/rules.d/, rather than suggest that people add additional lines to an already-existing file?

@peterharperuk
Copy link
Contributor Author

I'm going to close this and reopen if I can make sense of what's going on

@peterharperuk
Copy link
Contributor Author

Note: on Linux it shouldn't be necessary to run openocd as root or add another udev file. When you install openocd with apt it installs /lib/udev/rules.d.60-openocd.rules. One of the last rules is looking for a product that contains the text "CMSIS-DAP", which the debug probe uses. This gives permission if you're in the plugdev group. This should also work for a debug probe on a pico.

@lurch
Copy link
Contributor

lurch commented Feb 16, 2024

This gives permission if you're in the plugdev group.

...which most users already are on most Linux distros.

@aallan aallan added the unable unable to fulfil the request label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unable unable to fulfil the request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants